//
//  OrderStatusView.m
//  phmall
//
//  Created by admin on 2017/12/15.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "OrderStatusView.h"

@implementation OrderStatusView

-(instancetype)init{
    if (self=[super init]) {
        self.backgroundColor=[UIColor groupTableViewBackgroundColor];
        self.head=[[UIView alloc]init];
        self.head.backgroundColor=[UIColor orangeColor];
        [self addSubview:self.head];
        
        self.status=[[UILabel alloc]init];
        self.status.text=@"买家已付款\n等待商家打包包裹";
        self.status.textColor=[UIColor whiteColor];
        self.status.numberOfLines = 0;
        self.status.font=[UIFont systemFontOfSize:15];
        [self addSubview:self.status];
       
        
        self.statusImage=[[UIImageView alloc]init];
        self.statusImage.image=[UIImage imageNamed:@"待卖家发货"];
        [self addSubview:self.statusImage];
    
        self.addressView=[[UIView alloc]init];
        [self addSubview:self.addressView];
        self.addressView.backgroundColor=[UIColor whiteColor];
        
        
        self.addressImg=[[UIImageView alloc]init];
        self.addressImg.image=[UIImage imageNamed:@"收货地址-1"];
        [self.addressView addSubview:self.addressImg];
        
        self.name=[[UILabel alloc]init];
        self.name.text=@"收货人:啦啦啦";
        [self.addressView addSubview:self.name];
        self.name.font=[UIFont systemFontOfSize:15];
        
        self.address=[[UILabel alloc]init];
        self.address.text=@"收货地址:福建省 泉州市 石狮市 灵秀镇 世贸国际 华闽写字楼15楼 滚石网络有限公司 1503";
        [self.addressView addSubview:self.address];
        self.address.numberOfLines=0;
        self.address.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.address.font=[UIFont systemFontOfSize:13];
        
        self.phone=[[UILabel alloc]init];
        self.phone.text=@"联系电话:18658397382";
        [self.addressView addSubview:self.phone];
        self.phone.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.phone.font=[UIFont systemFontOfSize:13];
        
//        self.expressView=[[UIView alloc]init];
//        [self addSubview:self.expressView];
//        self.expressView.backgroundColor=[UIColor whiteColor];
        
//        self.expressImage=[[UIImageView alloc]init];
//        self.expressImage.image=[UIImage imageNamed:@"物流状态"];
//        [self.expressView addSubview:self.expressImage];
//
//        self.express=[[UILabel alloc]init];
//        self.express.text=@"正在打包包裹";
//        self.express.textColor=[UIColor colorWithHexString:@"#53adfb"];
//        [self.expressView addSubview:self.express];
//        self.express.font=[UIFont systemFontOfSize:15];
//
//        self.time=[[UILabel alloc]init];
//        self.time.text=@"2017.11.18";
//        self.time.textColor=[UIColor colorWithHexString:@"#adadad"];
//        [self.expressView addSubview:self.time];
//        self.time.font=[UIFont systemFontOfSize:13];
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    [self.head mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.offset(0);
        make.height.offset(70).priorityHigh();
    }];
//
    [self.status mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(40);

        make.centerY.equalTo(self.head).offset(0);
    }];

    [self.statusImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(self.head).offset(0);
        make.right.offset(-40);
        make.width.offset(70);
    }];
    
//    [self.expressView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.head.mas_bottom).offset(0);
//        make.left.right.offset(0);
//        make.height.offset(60).priorityHigh();
//    }];
    
//    [self.expressImage mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.offset(0);
//        make.left.offset(10);
//        make.height.width.offset(20);
//    }];
//
//    [self.express mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.offset(40);
//        make.top.offset(8);
//    }];
//
//    [self.time mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.offset(40);
//        make.bottom.offset(-8);
//    }];


    [self.addressView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.head.mas_bottom).offset(0);
        make.left.right.offset(0);
    }];
    
    [self.addressImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.offset(10);
        make.height.width.offset(20);
    }];

    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(40);
        make.top.offset(15);
    }];

    [self.address mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(40);
        make.width.offset(SCREEN_WIDTH-50);
        make.top.equalTo(self.name.mas_bottom).offset(6);
    }];

    [self.phone mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(40);
        //        make.width.offset(SCREEN_WIDTH-50);
        make.top.equalTo(self.address.mas_bottom).offset(6);
        make.bottom.offset(-15).priorityHigh();
    }];

}
-(void)setModel:(OrderModel *)model{
    self.status.text=model.status;
    self.address.text=model.address;
    self.phone.text=model.mobile;
    self.name.text=model.username;
}
@end
